/*
 * Created on 2006-3-16
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package  org.fantasy.common.util;

import java.util.Map;

/**
 * SQL脚本构造器
 * @author lrq
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
/**
 * @author lrq
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public abstract class AbstractSQLBuilder {	
	//protected String sql;                           //构造出来的SQL
	//protected String source;                        //输入的源串
	protected String encoding;                      //编码格式
	//protected Map paramMap;                         //参数集
		
	public AbstractSQLBuilder()throws SQLBuilderException{
		initBuilder();        
	}
	/**
	 * 构造方法
	 * @param source
	 * @param encoding
	 * @throws SQLBuilderException
	 */
	public AbstractSQLBuilder(String source, String encoding, Map map) throws SQLBuilderException{
        //this.source = source;
        this.encoding = encoding;
       // this.paramMap = map;
		initBuilder();
        //genSQL();
    }
	
	/**
	 * 初始化方法
	 * @throws SQLBuilderException
	 */
	protected abstract void initBuilder()throws SQLBuilderException;
	
	/**
	 * 此方法将source转为SQL脚本，SQL脚本赋予this.sql变量
	 * 输入参数paramMap和source
	 * @throws SQLBuilderException
	 */
	public abstract String genSQL(Map paramMap,String source)throws SQLBuilderException;
	
	/**
	 * @return Returns the sql.
	 */
	/*
	public String getSql() {
		return sql;
	}
	*/
	/**
	 * @param encoding The encoding to set.
	 */
	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}
	/**
	 * @param source The source to set.
	 */
	/*
	public void setSource(String source) {
		this.source = source;
	}
	*/
	/**
	 * @param paramMap The paramMap to set.
	 */
	/*
	public void setParamMap(Map paramMap) {
		this.paramMap = paramMap;
	}
	*/
}
